package main

import (
	"JoDocker/container"
	"fmt"
	"github.com/Sirupsen/logrus"
	"os/exec"
)

// 容器生成镜像 tar包
func commitContainer(containerName string, imageName string) {
	mntPath := fmt.Sprintf(container.MntPath, containerName) + "/"
	imageTarPath := container.RootPath + imageName + ".tar"
	fmt.Printf("tar path: %s", imageTarPath)
	if _, err := exec.Command("tar", "-czf", imageTarPath, "-C", mntPath, ".").CombinedOutput(); err != nil {
		logrus.Errorf("error => Tar folder %s error %v", mntPath, err)
	}
}
